package com.eastfair.certificate.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Size;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.certificate.enumeration.CertificateIndexClassifyEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 证件指标设置
 * </p>
 *
 * @author ligang
 * @since 2022-10-12
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cert_certificate_index")
@ApiModel(value = "CertificateIndex", description = "证件指标设置")
@AllArgsConstructor
public class CertificateIndex extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 已使用数量
     */
    @ApiModelProperty(value = "已使用数量")
    @TableField(value = "use_number")
    @Excel(name = "已使用数量")
    private Integer useNumber;

    /**
     * 限制数量
     */
    @ApiModelProperty(value = "限制数量")
    @TableField(value = "condition_number")
    @Excel(name = "限制数量")
    private Integer conditionNumber;

    /**
     * 证件分类:#{ARRANGE:布展证;MOVEOUT:撤展证;}
     */
    @ApiModelProperty(value = "证件分类:#{ARRANGE:布展证;MOVEOUT:撤展证;}")
    @TableField(value = "classify")
    @Excel(name = "证件分类:#{ARRANGE:布展证;MOVEOUT:撤展证;}", replace = {"布展证_ARRANGE", "撤展证_MOVEOUT",  "_null"})
    private CertificateIndexClassifyEnum classify;

    /**
     * 开始时间
     */
    @ApiModelProperty(value = "开始时间")
    @TableField(value = "start_time")
    @Excel(name = "开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime startTime;

    /**
     * 结束时间
     */
    @ApiModelProperty(value = "结束时间")
    @TableField(value = "end_time")
    @Excel(name = "结束时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime endTime;

    /**
     * 场地CODE
     */
    @ApiModelProperty(value = "场地CODE")
    @Size(max = 255, message = "场地CODE长度不能超过255")
    @TableField(value = "space_code", condition = LIKE)
    @Excel(name = "场地CODE")
    private String spaceCode;

    /**
     * 证件id
     */
    @ApiModelProperty(value = "证件id")
    @TableField(value = "certificate_id")
    @Excel(name = "证件id")
    private Long certificateId;

    /**
     * 展会id
     */
    @ApiModelProperty(value = "展会id")
    @TableField(value = "exhibition_id")
    @Excel(name = "展会id")
    private Long exhibitionId;

    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 团队id
     */
    @ApiModelProperty(value = "团队id")
    @TableField(value = "team_id")
    @Excel(name = "团队id")
    private Long teamId;


    @Builder
    public CertificateIndex(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer useNumber, Integer conditionNumber, CertificateIndexClassifyEnum classify, LocalDateTime startTime, LocalDateTime endTime, 
                    String spaceCode, Long certificateId, Long exhibitionId, Integer isEnabled, Integer isDeleted, Long tenantId, 
                    Long projectId, Long subsystemId, Long teamId) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.useNumber = useNumber;
        this.conditionNumber = conditionNumber;
        this.classify = classify;
        this.startTime = startTime;
        this.endTime = endTime;
        this.spaceCode = spaceCode;
        this.certificateId = certificateId;
        this.exhibitionId = exhibitionId;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.teamId = teamId;
    }

}
